/**
 * Project Name:mvc
 * File Name:UserController.java
 * Package Name:springTest.mvc.controller
 * Date:2015年8月25日下午12:06:55
 * Copyright (c) 2015, sid Jenkins All Rights Reserved.
 * 
 *
*/
package net.sidland.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.remoting.RemotingException;
import com.alibaba.dubbo.rpc.RpcException;

import net.sidland.service.BackService;

/**
 * ClassName:UserController
 * Date:     2015年8月25日 下午12:06:55 
 * @author   sid
 * @see 	 
 */
@RestController
@RequestMapping(value="/back")
public class BackController {
	private static Logger logger = LoggerFactory.getLogger(BackController.class);
	
	@Autowired
	private BackService helloService;
	
	@RequestMapping(value="/hello/{name}",method=RequestMethod.GET)
	public String sayHello(@PathVariable String name){
		logger.info("do something!");
        String sayHello = null;
        try {
            sayHello = helloService.backHello(name);
        } catch (RpcException e1) {
            return "service is RpcException!";
        } catch (RemotingException e1) {
            return "service is RemotingException!";
        }
		return sayHello;
	}
}

